﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using Microsoft.ApplicationBlocks.Data;

namespace AnyOffice.general.mobile
{
    public partial class send_rest : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int num = (Request.QueryString["page"] != null) ? int.Parse(Request.QueryString["page"]) : 1;
            int num2 = (Request.QueryString["mobile_id"] != null) ? int.Parse(Request.QueryString["mobile_id"]) : 0;
            SqlParameter[] commandParameters = new SqlParameter[2];
            commandParameters[0] = new SqlParameter("@UserId", SqlDbType.NVarChar, 20);
            commandParameters[0].Value = base.User.Identity.Name;
            commandParameters[1] = new SqlParameter("@MobileId", SqlDbType.Int);
            commandParameters[1].Value = num2;
            string commandText = "insert dbo.OutBox(username,mbno,Msg,SendTime,ComPort,Report) select username,mbno,Msg,SendTime,'0' as ComPort,'0' as Report from [Badoutbox] where id=@MobileId and V1=@UserId   delete from Badoutbox  where id=@MobileId and V1=@UserId";
            SqlHelper.ExecuteNonQuery(base.Conn, CommandType.Text, commandText, commandParameters);
            base.CloseConn();
            Response.Redirect("send_manage.aspx?page=" + num.ToString());
        } 

    }
}
